package com.cangxuan.manage.controller;

import com.cangxuan.manage.annotation.Check;
import com.cangxuan.manage.annotation.check.Max;
import com.cangxuan.manage.annotation.check.NotNull;
import com.cangxuan.manage.bean.Page;
import com.cangxuan.manage.entity.Goods;
import com.cangxuan.manage.entity.Series;
import com.cangxuan.manage.entity.UserAmountRecord;
import com.cangxuan.manage.service.ISeriesService;
import io.swagger.annotations.*;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 游星宇
 * 藏品系列相关控制器
 */
@Api(tags = "藏品系列相关接口")
@RestController
@RequestMapping("series")
public class SeriesController extends BaseController{
    ISeriesService iSeriesService;
    @Autowired
    public void setiSeriesService(ISeriesService iSeriesService) {
        this.iSeriesService = iSeriesService;
    }


    @Data
    @ApiModel("id查藏品系列")
    public static class SeriesPage{
        @ApiModelProperty("系列id")
        Integer id;
    }
    //saveSeries

    @PostMapping  ("get")
    @ApiOperation("查询全部系列")
    public Object select(){
        return  success(iSeriesService.list());
    }


    @PostMapping("save")
    @ApiOperation("保存系列")
    public Object save(@Check @RequestBody Series series) {
        iSeriesService.saveSeries(series);
        return success();
    }

    /**
     * 保存藏品
     * @param id
     * @return
     */
    @GetMapping("remove")
    @ApiOperation("删除系列")
    public Object remove(@RequestParam int id) {
        iSeriesService.remove(id);
        return success();
    }

}
